package com.ruitu.mall_98_2.mvp.model;

import com.ruitu.mall_98_2.dao.APIRetrofit;
import com.ruitu.mall_98_2.mvp.contract.PayOrderContract;
import com.ruitu.router_module.bean.api.BaseResult;
import com.ruitu.router_module.bean.order.NeedPay;
import com.ruitu.router_module.bean.order.PayReq;

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class PayOrderModel implements PayOrderContract.Model {
    @Override
    public Observable<BaseResult<String>> aliPayForApp(String status, String orderId) {
        return APIRetrofit.getDefault().aliPayForApp(status, orderId)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult> balanceForApp(String accountId, String code, String orderId) {
        return APIRetrofit.getDefault().balanceForApp(accountId, code, orderId)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult<PayReq>> weixinPayForApp(String status, String orderId) {
        return APIRetrofit.getDefault().weixinPayForApp(status, orderId)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io());
    }

    @Override
    public Observable<BaseResult<NeedPay>> getOrderMoney(String orderId) {
        return APIRetrofit.getDefault().getOrderMoney(orderId)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}
